package com.egao.orderB.controller;

import com.egao.common.core.annotation.ApiPageParam;
import com.egao.common.core.annotation.OperLog;
import com.egao.common.core.damon.results.PageResult2;
import com.egao.common.core.web.BaseController;
import com.egao.common.core.web.JsonResult;
import com.egao.orderB.entity.BillFeeTotal;
import com.egao.orderB.service.BillFeeTotalService;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;


/**
 *
 * 费用名称管理
 * @author : Doman
 * @date : 2020-12-10 15:11:17
 * @version ：1.0
 */
//这整个类都不要了
//@Api(tags = "费用名称管理")
//@RestController
//@RequestMapping("/api/orderB/billFeeTotal")
public class BillFeeTotalController extends BaseController {

	@Autowired
	private BillFeeTotalService billFeeTotalService;

	/**
	 * 分页查询列表
	 */
    //@OperLog(value = "费用名称管理", desc = "分页查询")
    @ApiOperation("分页查询费用名称管理")
    @ApiPageParam
    @PostMapping("/list")
    public JsonResult page(PageResult2<T> page, BillFeeTotal billFeeTotal) throws Exception{
        return billFeeTotalService.list(page, billFeeTotal, getLoginUser());
    }

    /**
     * 查询全部费用名称管理
     */
    //@OperLog(value = "费用名称管理", desc = "查询全部")
    @ApiOperation("查询全部费用名称管理")
    @PostMapping("/listAll")
    public JsonResult list(BillFeeTotal billFeeTotal){
        return billFeeTotalService.list(billFeeTotal, getLoginUser());
    }

    /**
     * 根据id查询费用名称管理
     */
    //@OperLog(value = "费用名称管理", desc = "根据id查询")
    @ApiOperation("根据id查询费用名称管理")
    @PostMapping("/get")
    public JsonResult get(BillFeeTotal billFeeTotal) {
        return billFeeTotalService.getById(billFeeTotal);
		// 使用关联查询
        //PageParam<billFeeTotal> pageParam = new PageParam<>();
		//pageParam.put("id", id);
        //List<billFeeTotal> records = billFeeTotalService.listAll(pageParam.getNoPageParam());
        //return JsonResult.ok().setData(pageParam.getOne(records));
    }


    /**
     * 添加费用名称管理
     */
    @OperLog(value = "费用名称管理", desc = "添加", param = false, result = true)
    @ApiOperation("添加费用名称管理")
    @PostMapping("/save")
    public JsonResult save(Model model, BillFeeTotal billFeeTotal) {
        return billFeeTotalService.save(billFeeTotal, getLoginUser());
    }

    /**
     * 修改费用名称管理
     */
    @OperLog(value = "费用名称管理", desc = "修改", param = false, result = true)
    @ApiOperation("修改费用名称管理")
    @PostMapping("/update")
    public JsonResult update(Model model, BillFeeTotal billFeeTotal) {
        return billFeeTotalService.update(billFeeTotal, getLoginUser());
    }

    /**
     * 删除费用名称管理
     */
    @OperLog(value = "费用名称管理", desc = "删除", result = true)
    @ApiOperation("删除费用名称管理")
    @PostMapping("/remove")
    public JsonResult remove(BillFeeTotal billFeeTotal ) {
        return billFeeTotalService.remove(billFeeTotal, getLoginUser());
    }

    /**
     * 批量添加费用名称管理
     */
    /**@RequiresPermissions("orderB:billFeeTotal:save")
    @OperLog(value = "费用名称管理", desc = "批量添加", param = false, result = true)
    @ResponseBody
    @PostMapping("/saveBatch")
    public JsonResult saveBatch(@RequestBody List<BillFeeTotal> list) {
        if (billFeeTotalService.saveBatch(list)) {
            return JsonResult.ok("添加成功");
        }
        return JsonResult.error("添加失败");
    }*/

    /**
     * 批量修改费用名称管理
     */
    /**@RequiresPermissions("orderB:billFeeTotal:update")
    @OperLog(value = "费用名称管理", desc = "批量修改", result = true)
    @ResponseBody
    @PostMapping("/updateBatch")
    public JsonResult updateBatch(@RequestBody BatchParam<BillFeeTotal> batchParam) {
        if (batchParam.update(billFeeTotalService, "")) {
            return JsonResult.ok("修改成功");
        }
        return JsonResult.error("修改失败");
    }*/

    /**
     * 批量删除费用名称管理
     */
    /**@RequiresPermissions("orderB:billFeeTotal:remove")
    @OperLog(value = "费用名称管理", desc = "批量删除", result = true)
    @ResponseBody
    @PostMapping("/removeBatch")
    public JsonResult removeBatch(@RequestBody List<Integer> ids) {
        if (billFeeTotalService.removeByIds(ids)) {
            return JsonResult.ok("删除成功");
        }
        return JsonResult.error("删除失败");
    }*/

}
